From 75e4e9bd322639c1047aa415a551dcbbf0028d32 Mon Sep 17 00:00:00 2001 From: Ewan Mellor Date: Sat, 9 Dec 2006 17:16:52 +0000 Subject: [PATCH] Implement xen_vm_set_vcpus_number, xen_vm_{add,remove}_vcpus_features_force{on,off}. Signed-off-by: Ewan Mellor --- tools/libxen/include/xen_vm.h | 39 +++++++++++++++++ tools/libxen/src/xen_vm.c | 80 +++++++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+) diff --git a/tools/libxen/include/xen_vm.h b/tools/libxen/include/xen_vm.h index 714ade6b16..02ae5220cd 100644 --- a/tools/libxen/include/xen_vm.h +++ b/tools/libxen/include/xen_vm.h @@ -606,6 +606,13 @@ extern bool xen_vm_set_vcpus_params(xen_session *session, xen_vm vm, char *params); +/** + * Set the VCPUs/number field of the given VM. + */ +extern bool +xen_vm_set_vcpus_number(xen_session *session, xen_vm vm, int64_t number); + + /** * Set the VCPUs/features/force_on field of the given VM. */ @@ -613,6 +620,22 @@ extern bool xen_vm_set_vcpus_features_force_on(xen_session *session, xen_vm vm, struct xen_cpu_feature_set *force_on); +/** + * Add the given value to the VCPUs/features/force_on field of the + * given VM. If the value is already in that Set, then do nothing. + */ +extern bool +xen_vm_add_vcpus_features_force_on(xen_session *session, xen_vm vm, enum xen_cpu_feature value); + + +/** + * Remove the given value from the VCPUs/features/force_on field of the + * given VM. If the value is not in that Set, then do nothing. + */ +extern bool +xen_vm_remove_vcpus_features_force_on(xen_session *session, xen_vm vm, enum xen_cpu_feature value); + + /** * Set the VCPUs/features/force_off field of the given VM. */ @@ -620,6 +643,22 @@ extern bool xen_vm_set_vcpus_features_force_off(xen_session *session, xen_vm vm, struct xen_cpu_feature_set *force_off); +/** + * Add the given value to the VCPUs/features/force_off field of the + * given VM. If the value is already in that Set, then do nothing. + */ +extern bool +xen_vm_add_vcpus_features_force_off(xen_session *session, xen_vm vm, enum xen_cpu_feature value); + + +/** + * Remove the given value from the VCPUs/features/force_off field of + * the given VM. If the value is not in that Set, then do nothing. + */ +extern bool +xen_vm_remove_vcpus_features_force_off(xen_session *session, xen_vm vm, enum xen_cpu_feature value); + + /** * Set the actions/after_shutdown field of the given VM. */ diff --git a/tools/libxen/src/xen_vm.c b/tools/libxen/src/xen_vm.c index 22ba6cc266..bffab2bab9 100644 --- a/tools/libxen/src/xen_vm.c +++ b/tools/libxen/src/xen_vm.c @@ -1180,6 +1180,22 @@ xen_vm_set_vcpus_params(xen_session *session, xen_vm vm, char *params) } +bool +xen_vm_set_vcpus_number(xen_session *session, xen_vm vm, int64_t number) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = vm }, + { .type = &abstract_type_int, + .u.int_val = number } + }; + + xen_call_(session, "VM.set_VCPUs_number", param_values, 2, NULL, NULL); + return session->ok; +} + + bool xen_vm_set_vcpus_features_force_on(xen_session *session, xen_vm vm, struct xen_cpu_feature_set *force_on) { @@ -1196,6 +1212,38 @@ xen_vm_set_vcpus_features_force_on(xen_session *session, xen_vm vm, struct xen_c } +bool +xen_vm_add_vcpus_features_force_on(xen_session *session, xen_vm vm, enum xen_cpu_feature value) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = vm }, + { .type = &xen_cpu_feature_abstract_type_, + .u.string_val = xen_cpu_feature_to_string(value) } + }; + + xen_call_(session, "VM.add_VCPUs_features_force_on", param_values, 2, NULL, NULL); + return session->ok; +} + + +bool +xen_vm_remove_vcpus_features_force_on(xen_session *session, xen_vm vm, enum xen_cpu_feature value) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = vm }, + { .type = &xen_cpu_feature_abstract_type_, + .u.string_val = xen_cpu_feature_to_string(value) } + }; + + xen_call_(session, "VM.remove_VCPUs_features_force_on", param_values, 2, NULL, NULL); + return session->ok; +} + + bool xen_vm_set_vcpus_features_force_off(xen_session *session, xen_vm vm, struct xen_cpu_feature_set *force_off) { @@ -1212,6 +1260,38 @@ xen_vm_set_vcpus_features_force_off(xen_session *session, xen_vm vm, struct xen_ } +bool +xen_vm_add_vcpus_features_force_off(xen_session *session, xen_vm vm, enum xen_cpu_feature value) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = vm }, + { .type = &xen_cpu_feature_abstract_type_, + .u.string_val = xen_cpu_feature_to_string(value) } + }; + + xen_call_(session, "VM.add_VCPUs_features_force_off", param_values, 2, NULL, NULL); + return session->ok; +} + + +bool +xen_vm_remove_vcpus_features_force_off(xen_session *session, xen_vm vm, enum xen_cpu_feature value) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = vm }, + { .type = &xen_cpu_feature_abstract_type_, + .u.string_val = xen_cpu_feature_to_string(value) } + }; + + xen_call_(session, "VM.remove_VCPUs_features_force_off", param_values, 2, NULL, NULL); + return session->ok; +} + + bool xen_vm_set_actions_after_shutdown(xen_session *session, xen_vm vm, enum xen_on_normal_exit after_shutdown) { -- 2.30.2